package com.company;

import redis.clients.jedis.Jedis;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class student {
    private JTextField textField1;
    private JPasswordField passwordField1;
    private JButton 登录Button;
    private JPanel panel1;
    private JPanel panel2;
    private JLabel 管理员账户Label;
    private JLabel 大连民族大学Label;
    private JLabel 管理员密码Label;
  public student(){
        JFrame student=new JFrame("学生");
        student.setSize(400,400);
        student.add(panel1);
        student.setLocation(400,250);
        student.setVisible(true);
      登录Button.addActionListener(new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
              String cmd = e.getActionCommand();
              if ("登录".equals(cmd)) {
                  String username = textField1.getText();
                  String userpassword = passwordField1.getText();
                  Jedis jedis=new Jedis("localhost",6379);
                  if(jedis.exists(textField1.getText()))
                  {
                      if (jedis.get(textField1.getText()).equals(passwordField1.getText())) {
                          new system();
                      }
                  }
                  jedis.close();

              }
          }
      });
  }

    public static void main(String[] args) {
        student st=new student();
    }
}